import { post, get } from '../utils/request'

// 获取系统消息列表
export const getSystemInfoList = ({ pageParam = 1 }) => {
  return post('/user/systemInfoListByPc', { page: pageParam })
}

// 获取点赞、评论、关注消息列表 type: 1点赞 2关注 3评论
export const getMessageList = ({ queryKey, pageParam = 1 }) => {
  const [, type] = queryKey
    // type = type==4?7:type;
  console.log(type)
  let typeValue
  if (type == 4) {
    typeValue = 7
  } else {
    typeValue = type
  }

  if(type===5){
    return get('/systemNotice/list', { page: pageParam,limit:20 })
  }else{
    return get('/message/list', { type: typeValue, page: pageParam })
  }
  
}

// 获取未读消息数量
export const getUnreadMessageCount = () => {
  return post('/message/num')
}

// 一键已读
export const allReadMessage = (type) => {
  return get('/message/status', { type })
}

// 一键已读系统信息
export const allReadSystemInfo = () => {
  return post('message/updateSystemStatus', {})
}

// 读取消息
export const readMessage = (param) => {
  return post('/message/readMessage', param)
}

// 读取系统消息
export const readSystemInfo = (param) => {
  return post('/message/articleMsgState', param)
}
